Qt Creator-日常报错
总阅读次
记录Qt Creator日常报错
- 中文乱码
问题描述1
warning: C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
解决办法:
- Qtcreator在fedora启动报错
ubuntu下
用新立得安装如下这两个包,qt的帮助文档可能用了流媒体。
libgstreamer0.10-dev
libgstreamer-plugins-base0.10-dev
http://bbs.csdn.net/topics/391878342
http://www.itnpc.com/news/web/146163065659641.html
- newline in constant错误原因:输入了中文字符
1
error: C2001: newline in constant
例如:
编译器会报错的源码:1
2
3
4
5
6
7
8
9void MainWindow::on_pushButton_13_clicked() //`-`按键
{
what =1;
next=pre;
pre=" ";
QString str;
str=str.append("——"); //错误位置
ui->Input->setText(str);
}
把str=str.append("——");
改成str=str.append("-");
即可
- qt creator无法编译Empty qmake project工程
检查.pro、源文件(.cpp)以及缺失存在QApplication文件存在之后仍然报以下错
1 | Cannot open include file: 'QApplication': No such file or directory |
解决办法:
执行qmake
- ‘cl’ 命令不识别
1
2
3
4
5
6
7
8
9'cl' is not recognized as an internal or external command,
operable program or batch file.
jom: C:\Qt\Qt5.8.0\Examples\Qt-5.8\widgets\widgets\build-analogclock-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\main.obj] Error 1
jom: C:\Qt\Qt5.8.0\Examples\Qt-5.8\widgets\widgets\build-analogclock-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug\Makefile [debug] Error 2
16:07:35: The process "C:\Qt\Qt5.8.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project analogclock (kit: Desktop Qt 5.8.0 MSVC2015_64bit)
The kit Desktop Qt 5.8.0 MSVC2015_64bit has configuration issues which might be the root cause for this problem.
When executing step "Make"
16:07:35: Elapsed time: 00:00.
同时打开对应版本的Developer Command Prompt for VS2015
1 | '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VCVarsQueryRegistry.bat"' is not recognized as an internal or external command, |
没有头文件,环境问题
1
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\crtdefs.h:10: error: C1083: Cannot open include file: 'corecrt.h': No such file or directory
Qt动态加载dll
1 | D:\gx_2017\2017-07\0\TVM_\Qt_CTicketTransportI_TVM\Qt_CTicketTransportI_TVM\main.cpp:-1: warning: C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss |
解决:
1 | LPCWSTR dllname=L"equ_TicketTransportImpl_token.dll"; |
- 报错: 常量中有换行符换行符
解决:
在中文末尾加|
即可消除中文编码报错的问题
- Cannot retrieve debugging output
解决:
开了2个Qt Creator;只留一个即可
- 链接错误 LNK2019: 无法解析的外部符号 “public: __thiscall
1 | 09:16:29: 为项目Qt_CCardRecycle_SZ7A执行步骤 ... |
windeployqt.exe 发布程序
1 | C:\Qt\Qt5.4.1\5.4\msvc2013\bin>windeployqt.exe D:\gx_2017\2017-07\0\TVM_\Qt_CTicketTransportI_TVM\build-Qt_CTicketTransportI_TVM-Desktop_Qt_5_4_1_MSVC2013_32bit-Debug\debug\Qt_CTicketTransportI_TVM.exe |
解决:
环境问题
- 缺少core.h文件